﻿using Assignment_3.Classes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Assignment_3.Feature___Housekeeping
{
    public partial class UpdateScheduleProgress : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["username"] == null || Session["usertype"] == null)
            {
                Response.Redirect("~/Feature - Users/Login.aspx");
            }

            string id = Request.QueryString["housekeepingID"];
            lblSuccess.Text = "The Schedule's progress, ID: " + id + ", is updated successfully!";

            Object[] housekeeping = DatabaseManager.GetHouseKeepingById(Convert.ToInt32(id));

            lblScheduleID.Text = Convert.ToString((int)housekeeping[0]);
            lblStaffID.Text = Convert.ToString((int)housekeeping[1]);
            lblName.Text = (string)housekeeping[2];
            lblDuty.Text = (string)housekeeping[3];
            lblRoomID.Text = Convert.ToString((int)housekeeping[4]);
            DateTime date = (DateTime)housekeeping[5];
            lblDateOfDuty.Text = string.Format("{0:yyyy-MM-dd}", date);
            lblProgress.Text = (string)housekeeping[6];
            lblRoomStatus.Text = (string)housekeeping[7];
        }

        protected void tbnView_Click(object sender, EventArgs e)
        {
            Response.Redirect("RetrieveSchedule.aspx?");
        }
    }
}